package ebusiness.ebusiness.Models.Front.ShoppingTorlley;

import ebusiness.ebusiness.Entity.Address;
import ebusiness.ebusiness.Entity.Good;

import ebusiness.ebusiness.Entity.Order;
import ebusiness.ebusiness.Entity.UserEntity.User;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public abstract class TorlleyModel {
    private List<Good> goods;
  private    HashMap<Integer,Integer> nums;
  private    HashMap<Integer,Boolean> selected;
 private     int user=-1;
 public abstract int addGood(int id) throws Exception;
  public   abstract int addGood(Good gd) ;
 public    abstract  int removeGood(int id) ;
  public abstract int modifyGoodNum(int id,int num);
  public abstract void show(CartView cartView);


  public TorlleyModel(){
      goods=new ArrayList<>();
      nums=new HashMap<>();
      selected=new HashMap<>();
  }
  public TorlleyModel(List<Good> gd,HashMap<Integer,Integer> num,HashMap<Integer,Boolean> select){

      this.goods=gd;
      this.nums=num;
      this.selected=select;
      if(goods==null)goods=new ArrayList<>();
      if(nums==null)nums=new HashMap<>();
      if(selected==null)selected=new HashMap<>();
  }

    void setUser(int user){
        this.user=user;
    };
    int getUser(){
        return this.user;
    }
   public HashMap<Integer,Integer> getNums(){
        return this.nums;
    }
   public HashMap<Integer,Boolean> getSelectedList(){
        return this.selected;
    }

    public List<Good> getGoods() {
        return goods;
    }


}
